<%-- 
    Document   : altera_endereco
    Created on : 16/08/2013, 11:17:57
    Author     : Aluno
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Pesquisar Endereco</title>
    </head>
    <body>
        <div id =" geral">
            <h1>Hello World!</h1>
            <form id="form" action="EnderecoServlet?cmd=pesqLocal" method="POST">
                <fieldset>
                    <legend>Pesquisa por Local</legend>
                    <div>
                        <label>Local:</label>
                        <input name="local" type="text" size="35" />
                        <input value="pesquisar" type="submit" />
                    </div>
                </fieldset>
                <c:if test="${!empty enderecos}">
                    <table border="1">
                        <tr>
                            <th>Alterar</th>
                            <th>Local</th>                        
                            <th>Rua</th>                        
                            <th>Bairro</th>                        
                            <th>Cidade</th>                        
                            <th>Estado</th>
                            <th>CEP</th>
                            <th>Capacidade Maxima</th>
                            <th>Excluir</th>
                        </tr>
                        <c:forEach var="ende" items="${enderecos}">
                            <tr>
                                <td>
                                    <a href="EnderecoServlet?cmd=procurarId&id=${ende.id}">Alterar</a>
                                </td>
                                <td>
                                    ${ende.local}
                                </td>
                                <td>
                                    ${ende.rua}
                                </td>
                                <td>
                                    ${ende.bairro}
                                </td>
                                <td>
                                    ${ende.cidade}
                                </td>
                                <td>
                                    ${ende.estado}
                                </td>                            
                                <td>
                                    ${ende.cep}
                                </td>                            
                                <td>
                                    ${ende.capacidadeMaxima}
                                </td>                            
                                <td>
                                    <a href="EnderecoServlet?cmd=excluir&id=${ende.id}">Excluir</a>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </c:if>
                <c:if test="${!empty msg}">
                    <script type="text/javascript">
                    alert('${msg}');
                    </script>
                </c:if>
            </form> 
        </div>
    </body>
</html>
